<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"
%><%@ taglib prefix="tags" tagdir="/WEB-INF/tags"
%><%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"
%><%@ taglib prefix="security" uri="http://www.springframework.org/security/tags"
%><%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"
%><%@ taglib prefix="spring" uri="http://www.springframework.org/tags"
%><%@ taglib prefix="tags" tagdir="/WEB-INF/tags"
%><%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"
%>
<head>
	<link href="<c:url value="/skins/styles/account.css"/>" type="text/css" rel="stylesheet">
	<title><fmt:message key="shoppingOrder" /></title>
	<script type="text/javascript" src="<c:url value="/script/kissy/1.1.6/tbra-aio.js" />"> </script>
	<script type="text/javascript" src="<c:url value="/script/kissy/1.1.6/tbww_v1.1.js" />"> </script>
	<script type="text/javascript" src="<c:url value="/script/kissy/1.1.6/fastbuy_prepaid.js" />"> </script>
	<script type="text/javascript" src="<c:url value="/script/kissy/1.1.6/order_fastbuy_districtselector.js" />"> </script>
</head>
<body>
<c:url var="homeUrl" value="/"/>
<div id="nav-crumbs1" class="crumbs">您的位置：<a href="${homeUrl}">首页</a><span>&gt;</span>
	<a href="${homeUrl}user/index">会员中心</a><span>&gt;</span>
	收货地址
</div>

<style>
.btn, .small-btn, .long-btn, .short-btn, .small-long-btn {
	background: url("${homeUrl}skins/styles/img/btn_bg.png") no-repeat;
	width: 80px;
	height: 25px;
	line-height: 25px;
	display: inline-block;
	text-align: center;
	font-size: 14px;
	font-weight: bold;
	border: none;
	cursor: pointer;
	color: white;
}
</style>


<div class="account-security security-deliver" id="main-content">
<c:if test="${empty address.inode}">
<c:url var="createUrl" value="/domain/address/create"/>
</c:if>
<c:if test="${not empty address.inode}">
<c:url var="createUrl" value="/domain/address/update"/>
</c:if>
<form name="mainform" action="${createUrl}" method="post" id="mytaobao-junk">    
	<h2 class="h2-single"><span class="entity">收货地址</span></h2>
	<h3><span class="entity-h3">新增收货地址</span>除电话号码外，其余均为必填项</h3>
    <ul class="elem-form section trade:addressEditor" id="ah:addressForm"> 
        <li>
			<label class="label-like" for="name">收货人姓名:</label>
			<p>
				<input type="hidden" name="address.inode" value="${address.inode}">
				<input type="text" name="name" id="address.name" value="${address.name}" class="inputtext input-long">
				<span class="spark-indeed">*</span>
			</p> 
		</li>        
        <li><label class="label-like">所在地区:</label>
            <p>
                <select name="address.state" title="省" id="J_Province"><option value=""></option><option value="110000">北京</option><option value="120000">天津</option><option value="130000">河北省</option><option value="140000">山西省</option><option value="150000">内蒙古自治区</option><option value="210000">辽宁省</option><option value="220000">吉林省</option><option value="230000">黑龙江省</option><option value="310000">上海</option><option value="320000">江苏省</option><option value="330000">浙江省</option><option value="340000">安徽省</option><option value="350000">福建省</option><option value="360000">江西省</option><option value="370000">山东省</option><option value="410000">河南省</option><option value="420000">湖北省</option><option value="430000">湖南省</option><option value="440000">广东省</option><option value="450000">广西壮族自治区</option><option value="460000">海南省</option><option value="500000">重庆</option><option value="510000">四川省</option><option value="520000">贵州省</option><option value="530000">云南省</option><option value="540000">西藏自治区</option><option value="610000">陕西省</option><option value="620000">甘肃省</option><option value="630000">青海省</option><option value="640000">宁夏回族自治区</option><option value="650000">新疆维吾尔自治区</option><option value="710000">台湾省</option><option value="810000">香港特别行政区</option><option value="820000">澳门特别行政区</option><option value="990000">海外</option></select> 省 
				<select name="address.city" title="市" id="J_City"><option value="">城市</option></select> 市 
				<select name="address.street1" title="区" id="J_Area"><option value="">区县</option></select> 区
				<input id="divisionCode" class="pc:divisionCode" value="110000" type="hidden" name="_fmm.d._0.d">
				<span class="spark-indeed">*</span>
			</p>                   
        </li>

			<script type="text/javascript">
				(function(){
					var Y = YAHOO,
					L = Y.lang,
					U = Y.util,
					C = U.Connect,
					D = U.Dom,
					E = U.Event;
					YAHOO.util.Event.throwErrors = true;
					E.onDOMReady(function(){
						//        alert(TB.Fastbuy.init);
						TB.app.FastBuy.init({
							ShippingFee:
							10.00 							,
							Rebate:
							0.00 						}
						);
					}
					);
				}
				)();
			</script>

        <li><label class="label-like" for="street2">街道地址:</label>        
            <p>
				<textarea name="address.street2" id="street2" rows="3" cols="60" style="margin-top: 0px; margin-bottom: 0px; height: 42px; margin-left: 0px; margin-right: 0px; width: 317px; ">${address.street2}</textarea>
				<span class="spark-indeed">*</span>
				<span class="ex-margin-left ex-weaken-gray">不需要重复填写省/市/区</span>
			</p>                   
        </li> 
        <li>
			<label class="label-like" for="zip">邮政编码:</label>
			<input type="text" name="address.zip" id="zip" value="${address.zip}" class="inputtext input-short ds:areaCode">
			<span class="spark-indeed">*</span>
			<span class="ex-margin-left ex-weaken-gray">大陆以外地区可不填写</span>
		</li>
        <li>
			<label class="label-like">电话号码:</label>
			<input type="text" name="address.phone" title="电话号码" value="${address.phone}" id="phoneCode" class="inputtext input-tel-num">
			<span class="ex-margin-left ex-weaken-gray">区号-电话号码-分机</span>
		</li>
        <li>
			<label class="label-like" for="mobilePhone">手机号码:</label>
			<p>
				<input type="text" name="address.cell" value="${address.cell}" id="mobilePhone" class="inputtext input-long">
			</p> 
		</li>   
		<li>
			<label class="label-like" for="statusAddr">设为默认:</label>
			<c:if test="${address.isDefault}">
			<input type="checkbox" name="address.isDefault" id="statusAddr" checked>
			</c:if>
			<c:if test="${!address.isDefault}">
			<input type="checkbox" name="address.isDefault" id="statusAddr">
			</c:if>
		</li>   
        <li class="container-btn">
		<c:if test="${empty address.inode}">
		<div class="skin-gray" id="createD">
			<button type="submit" class="short-btn">保存</button>
		</div>
		</c:if>
		<c:if test="${not empty address.inode}">
        <div class="skin-gray" id="updateD">
			<button type="submit" class="short-btn">保存</button>
		</div>
		</c:if>
		</li>
    </ul>  
    <div class="tbl-deliver-address">
        <table border="0" cellspacing="0" cellpadding="0" class="tbl-main">
            <caption>已保存的有效地址</caption>
            <colgroup>
                <col class="col-man">
                <col class="col-area">
                <col class="col-address">
                <col class="col-postcode">
                <col class="col-phone">
                <col class="col-actions">
            </colgroup>
			<tbody><tr class="thead-tbl-grade">
                <th>收货人</th>
				<th>所在地区</th>
				<th>街道地址</th>
				<th>邮编</th>
				<th>电话/手机</th>
				<th></th>
				<th>操作</th>        
            </tr>
			<c:url var="updateUrl" value="/domain/address/update"/>
			<c:url var="deleteUrl" value="/domain/address/delete"/>
			<c:url var="defaultUrl" value="/domain/address/default"/>
			
			<c:forEach items="${addresses}" var="address" >
			<tr class="thead-tbl-address" id="${address.inode}" bgcolor="white">
				<td class="cell-align-center">${address.name}</td>
				<td>${address.state} ${address.city} ${address.street1}</td>
				<td>${address.street2}</td>
				<td class="cell-align-center">${address.zip}</td>
				<td><br>${address.phone} / ${address.cell}</td>
                <td class="thead-tbl-status" style="color:blue">
					<c:if test="${address.isDefault}">
						默认地址
					</c:if>
				</td>
				<td class="cell-align-center">
					<a href="${updateUrl}/${address.inode}">修改</a> | 
					<a href="${deleteUrl}/${address.inode}">删除</a> |
					<a href="${defaultUrl}/${address.inode}">设为默认</a>
				</td>
			</tr>
			</c:forEach>
			</tbody>
		</table>
        <p class="tbl-attach">最多保存10个有效地址</p>
    </div>
	</form>
</div>
</body>